package web.servlet.request.test;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Iterator;

/**
 * @Author Administrator
 * @Date 2020/5/15 10:08
 **/
@WebServlet("/getServlet")
public class GetServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        StringBuffer requestURL = req.getRequestURL();
        System.out.println(requestURL);
        String method = req.getMethod();
        System.out.println(method);
        String header = req.getHeader("User-Agent");
        System.out.println(header);
        String name = req.getParameter("name");
        System.out.println(name);

    }
}
